package model.query;

import main.HibernateUtil;
import org.hibernate.Session;
import model.*;

/**
 *
 * @author cska
 *
 */

public class Update {

    private Session session;

    public Update() {
        super();
    }

    private void begin() {
        session = HibernateUtil.getSessionFactory().getCurrentSession();
        session.beginTransaction();
    }

    private void commit() {
        session.getTransaction().commit();
    }

    public void group(Group group) {
        begin();
        session.update(group);
        commit();
    }

    public void teacher(Teacher teacher) {
        begin();
        session.update(teacher);
        commit();
    }

    public void subject(Subject subject) {
        begin();
        session.update(subject);
        commit();
    }

    public void student(Student student) {
        begin();
        session.update(student);
        commit();
    }

    public void lesson(Lesson lesson) {
        begin();
        session.update(lesson);
        commit();
    }

    public void skip(Skip skip) {
        begin();
        session.update(skip);
        commit();
    }

    public void gts(Group_Teacher_Subject gts) {
        begin();
        session.update(gts);
        commit();
    }

    public void lab(Lab lab) {
        begin();
        session.update(lab);
        commit();
    }

    public void ls(Lab_Student ls) {
        begin();
        session.update(ls);
        commit();
    }

    public void interim(Interim interim) {
        begin();
        session.update(interim);
        commit();
    }

    public void admin(Admin admin) {
        begin();
        session.update(admin);
        commit();
    }

}
